package com.global.vo;

/**
 * SQL中栏位信息
 * @author zly601436
 *
 */
public class DBColumn {

	private String alias;
	private String description;
	private int displayIndex;
	
	private String columnTypeName;

	/**
	 * 返回数据源中的字段别名
	 * @return String
	 */
	public String getAlias() {
		return alias;
	}
	/**
	 * 设置数据源中的字段别名
	 * @param name
	 */
	public void setAlias(String alias) {
		this.alias = alias;
	}

	/**
	 * 返回数据源中的字段描述
	 * @return String
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * 设置数据源中的字段描述
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * 返回显示顺序
	 * @return int
	 */
	public int getDisplayIndex() {
		return displayIndex;
	}
	/**
	 * 设置显示顺序
	 * @param index
	 */
	public void setDisplayIndex(int displayIndex) {
		this.displayIndex = displayIndex;
	}

	/**
	 * 返回数据源中的字段的SQL数据类型名称
	 * @return String
	 */
	public String getColumnTypeName() {
		return columnTypeName;
	}
    /**
     * 设置数据源中的字段的SQL数据类型名称
     * @param columnTypeName
     */
	public void setColumnTypeName(String columnTypeName) {
		this.columnTypeName = columnTypeName;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((alias == null) ? 0 : alias.hashCode());
		result = prime * result
				+ ((columnTypeName == null) ? 0 : columnTypeName.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DBColumn other = (DBColumn) obj;
		if (alias == null) {
			if (other.alias != null)
				return false;
		} else if (!alias.equals(other.alias))
			return false;
		if (columnTypeName == null) {
			if (other.columnTypeName != null)
				return false;
		} else if (!columnTypeName.equals(other.columnTypeName))
			return false;
		return true;
	}

	@Override
	public String toString() {
        /*
        ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
        .append("alias", this.alias)
        .append("description", this.description)
        .append("displayIndex", this.displayIndex)
        .append("columnTypeName", this.columnTypeName);

        return sb.toString();
        
        */

		return "DBColumn [alias=" + alias + ", description=" + description
				+ ", displayIndex=" + displayIndex + ", columnTypeName="
				+ columnTypeName + "]";
	}
}
